package com.weixing.mall.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weixing.mall.provider.mapper.ClosureMapper;
import com.weixing.mall.provider.model.domain.Closure;
import com.weixing.mall.provider.model.domain.SeckillImport;
import com.weixing.mall.provider.model.query.BannerQuery;
import com.weixing.mall.provider.service.IClosureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Small
 * @since 2020-04-23
 */
@Service
public class ClosureServiceImpl extends ServiceImpl<ClosureMapper, Closure> implements IClosureService {


    @Autowired
    ClosureMapper closureMapper;
    @Override
    public IPage<Closure> selectOfPage(Page initMpPage) {
        return closureMapper.selectOfPage(initMpPage);
    }

    @Override
    public String loadByCode(String code) {
        QueryWrapper wrapper = new QueryWrapper<Closure>().eq("code", code);
        Closure closure= getOne(wrapper);
        return closure==null?"":closure.getUrl();
    }
}
